/*
 * rigidBody.cpp
 *
 *  Created on: Feb 15, 2012
 *      Author: Michael Ziminsky
 */

RigidBody::RigidBody(const RigidBody &b) :
        _position(b._position), _velocity(b._velocity), _mass(b._mass), _elastic(b._elastic)
{
}

RigidBody::RigidBody(const vector3 &pos, const vector3 & vel, scalar m, scalar e) :
        _position(pos), _velocity(vel), _mass(m), _elastic(e)
{
}

RigidBody::RigidBody(scalar m, scalar e) :
        _position("0 0 0"), _velocity("0 0 0"), _mass(m), _elastic(e)
{
}

RigidBody::~RigidBody()
{
}

scalar RigidBody::mass() const
{
    return _mass;
}

scalar RigidBody::invMass() const
{
    return _mass ? 1.0 / _mass : 0;
}

void RigidBody::mass(scalar m)
{
    _mass = m;
}

scalar RigidBody::elasticity() const
{
    return _elastic;
}

void RigidBody::elasticity(scalar e)
{
    _elastic = e;
}

const vector3& RigidBody::velocity() const
{
    return _velocity;
}

void RigidBody::velocity(const vector3& v)
{
    velocity(v[0], v[1], v[2]);
}

void RigidBody::velocity(scalar x, scalar y, scalar z)
{
    _velocity[0] = x;
    _velocity[1] = y;
    _velocity[2] = z;
}

const vector3& RigidBody::position() const
{
    return _position;
}

void RigidBody::position(const vector3& p)
{
    position(p[0], p[1], p[2]);
}

void RigidBody::position(scalar x, scalar y, scalar z)
{
    _position[0] = x;
    _position[1] = y;
    _position[2] = z;
}


scalar RigidBody::pX() const
{
    return _position[0];
}
scalar RigidBody::pY() const
{
    return _position[1];
}
scalar RigidBody::pZ() const
{
    return _position[2];
}

scalar RigidBody::vX() const
{
    return _velocity[0];

}
scalar RigidBody::vY() const
{
    return _velocity[1];

}
scalar RigidBody::vZ() const
{
    return _velocity[2];

}

/*
void RigidBody::pX(scalar x)
{
    _position[0] = x;
}
void RigidBody::pY(scalar y)
{
    _position[1] = y;
}
void RigidBody::pZ(scalar z)
{
    _position[2] = z;
}

void RigidBody::vX(scalar x)
{
    _velocity[0] = x;
}
void RigidBody::vY(scalar y)
{
    _velocity[1] = y;
}
void RigidBody::vZ(scalar z)
{
    _velocity[2] = z;
}*/
